home *** CD-ROM | disk | FTP | other *** search
/ Software of the Month Club 2000 October / Software of the Month - Ultimate Collection Shareware 277.iso / pc / PROGRAMS / UTILITY / WINLINUX / DATA1.CAB / programs_-_include / LINUX / SUNRPC / AUTH.H < prev    next >
C/C++ Source or Header  |  1999-09-17  |  3KB  |  102 lines

  1. /*
  2.  * linux/include/linux/auth.h
  3.  *
  4.  * Declarations for the RPC authentication machinery.
  5.  *
  6.  * Copyright (C) 1996, Olaf Kirch <okir@monad.swb.de>
  7.  */
  8.  
  9. #ifndef _LINUX_SUNRPC_AUTH_H
  10. #define _LINUX_SUNRPC_AUTH_H
  11.  
  12. #ifdef __KERNEL__
  13.  
  14. #include <linux/config.h>
  15. #include <linux/sunrpc/sched.h>
  16.  
  17. /* size of the nodename buffer */
  18. #define UNX_MAXNODENAME    32
  19.  
  20. /*
  21.  * Client user credentials
  22.  */
  23. struct rpc_cred {
  24.     struct rpc_cred *    cr_next;    /* linked list */
  25.     unsigned long        cr_expire;    /* when to gc */
  26.     unsigned short        cr_count;    /* ref count */
  27.     unsigned short        cr_flags;    /* various flags */
  28.  
  29.     uid_t            cr_uid;
  30.  
  31.     /* per-flavor data */
  32. };
  33. #define RPCAUTH_CRED_LOCKED    0x0001
  34. #define RPCAUTH_CRED_UPTODATE    0x0002
  35. #define RPCAUTH_CRED_DEAD    0x0004
  36.  
  37. /*
  38.  * Client authentication handle
  39.  */
  40. #define RPC_CREDCACHE_NR    8
  41. struct rpc_auth {
  42.     struct rpc_cred *    au_credcache[RPC_CREDCACHE_NR];
  43.     unsigned long        au_expire;    /* cache expiry interval */
  44.     unsigned long        au_nextgc;    /* next garbage collection */
  45.     unsigned int        au_cslack;    /* call cred size estimate */
  46.     unsigned int        au_rslack;    /* reply verf size guess */
  47.     unsigned int        au_flags;    /* various flags */
  48.     struct rpc_authops *    au_ops;        /* operations */
  49.  
  50.     /* per-flavor data */
  51. };
  52. #define RPC_AUTH_PROC_CREDS    0x0010        /* process creds (including
  53.                          * uid/gid, fs[ug]id, gids)
  54.                          */
  55.  
  56. /*
  57.  * Client authentication ops
  58.  */
  59. struct rpc_authops {
  60.     unsigned int        au_flavor;    /* flavor (RPC_AUTH_*) */
  61. #ifdef RPC_DEBUG
  62.     char *            au_name;
  63. #endif
  64.     struct rpc_auth *    (*create)(struct rpc_clnt *);
  65.     void            (*destroy)(struct rpc_auth *);
  66.  
  67.     struct rpc_cred *    (*crcreate)(struct rpc_task *);
  68.     void            (*crdestroy)(struct rpc_cred *);
  69.  
  70.     int            (*crmatch)(struct rpc_task *, struct rpc_cred*);
  71.     u32 *            (*crmarshal)(struct rpc_task *, u32 *, int);
  72.     int            (*crrefresh)(struct rpc_task *);
  73.     u32 *            (*crvalidate)(struct rpc_task *, u32 *);
  74. };
  75.  
  76. extern struct rpc_authops    authunix_ops;
  77. extern struct rpc_authops    authnull_ops;
  78. #ifdef CONFIG_SUNRPC_SECURE
  79. extern struct rpc_authops    authdes_ops;
  80. #endif
  81.  
  82. int            rpcauth_register(struct rpc_authops *);
  83. int            rpcauth_unregister(struct rpc_authops *);
  84. struct rpc_auth *    rpcauth_create(unsigned int, struct rpc_clnt *);
  85. void            rpcauth_destroy(struct rpc_auth *);
  86. struct rpc_cred *    rpcauth_lookupcred(struct rpc_task *);
  87. void            rpcauth_holdcred(struct rpc_task *);
  88. void            rpcauth_releasecred(struct rpc_task *);
  89. int            rpcauth_matchcred(struct rpc_task *, struct rpc_cred *);
  90. u32 *            rpcauth_marshcred(struct rpc_task *, u32 *);
  91. u32 *            rpcauth_checkverf(struct rpc_task *, u32 *);
  92. int            rpcauth_refreshcred(struct rpc_task *);
  93. void            rpcauth_invalcred(struct rpc_task *);
  94. int            rpcauth_uptodatecred(struct rpc_task *);
  95. void            rpcauth_init_credcache(struct rpc_auth *);
  96. void            rpcauth_free_credcache(struct rpc_auth *);
  97. void            rpcauth_insert_credcache(struct rpc_auth *,
  98.                         struct rpc_cred *);
  99.  
  100. #endif /* __KERNEL__ */
  101. #endif /* _LINUX_SUNRPC_AUTH_H */
  102.